Found some wierdness, running KMotion 4.32 on Win7: see the following code:
typedef struct
{
float spd;
float backspd;
double postmove;
int limsw;
enum
{
S_FWD,
S_WAITHIT,
S_BACK,
S_WAITOFF,
S_WAITPOST,
S_DONE
} state;
} home_t;
void ref_axes(unsigned amask, float spd)
{
home_t h[N_AXES];
int i;
int running = 0;
for (i = 0; i < N_AXES; ++i)
{
h[i].state = S_DONE;
h[i].limsw = chan[i].LimitSwitchPosBit;
h[i].spd = 0.;
if (amask & (1u<<i))
{
// Doing this one. For now, use these defaults...
h[i].state = S_FWD;
h[i].spd = spd;
h[i].backspd = -spd*0.125;
h[i].postmove = -MM_TO_STEPS(2.);
if (h[i].postmove < 0.)
printf("Post moving axis %d (neg) %g\n", i, h[i].postmove);
if (h[i].postmove == 0.)
printf("Post moving axis %d (zero) %g\n", i, h[i].postmove);
if (h[i].postmove > 0.)
printf("Post moving axis %d (pos) %g\n", i, h[i].postmove);
++running;
}
}
// blah blah...
}Basically implementing a state machine for reffing one or more axes simultaneously. The strange thing is that, even though I set the postmove (double) field to -2000, the second of the debug printf's gets run (not the first!). Output on the KMotion console is: